package com.djsearch.adapter;

import java.util.List;

import com.djsearch.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.TextView;
/**
 * 查询方式窗口中listview的适配器
 * @author chenyang2
 *
 */
//public class SearchWayPopuAdapter extends BaseAdapter{
//
//	private Context mContext;
//	
//	public SearchWayPopuAdapter(Context context) {
//		mContext = context;
//	}
//	
//	@Override
//	public int getCount() {
//		// TODO Auto-generated method stub
//		return 20;
//	}
//
//	@Override
//	public Object getItem(int position) {
//		// TODO Auto-generated method stub
//		return position;
//	}
//
//	@Override
//	public long getItemId(int position) {
//		// TODO Auto-generated method stub
//		return position;
//	}
//
//	@Override
//	public View getView(int position, View convertView, ViewGroup parent) {
//		// TODO Auto-generated method stub
//		
//		convertView = LayoutInflater.from(mContext).inflate(
//				R.layout.city_check_list_itme, null);// 用LayoutInflater装载布局。
//		TextView localText = (TextView)convertView.findViewById(R.id.cityName);
//		
//		localText.setText("选择");
//		
//		return convertView;
//	}
//
//}


public class SearchWayPopuAdapter extends ArrayAdapter<String>{ 
    
    private List<String> listTag = null; 
    public SearchWayPopuAdapter(Context context, List<String> objects, List<String> tags) { 
        super(context, 0, objects); 
        this.listTag = tags; 
    } 
      
    @Override 
    public boolean isEnabled(int position) { 
        if(listTag.contains(getItem(position))){ 
            return false; 
        } 
        return super.isEnabled(position); 
    } 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) { 
        View view = convertView; 
        if(listTag.contains(getItem(position))){ 
        	view = LayoutInflater.from(getContext()).inflate(R.layout.city_zimu_item, null); 
        }else{                     
            view = LayoutInflater.from(getContext()).inflate(R.layout.city_check_list_itme, null);
        } 
        TextView textView = (TextView) view.findViewById(R.id.cityName); 
        textView.setText(getItem(position)); 
        return view; 
    } 
} 
